package com.san.hkhospital.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.san.hkhospital.vo.ApparatusTableVo;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import com.san.hkhospital.mapper.ApparatusMapper;
import com.san.hkhospital.entity.Apparatus;
import com.san.hkhospital.service.ApparatusService;
import org.springframework.transaction.annotation.Transactional;

/**
 * ClassName:ApparatusServiceImpl
 * PackageName:com.san.hkhospital.service.impl
 * Description:
 *
 * @Author:yy
 * @CreatedAt:2024/11/11 10:59
 * 
 */
 
 
@Service
@Transactional
public class ApparatusServiceImpl implements ApparatusService{

    @Resource
    private ApparatusMapper apparatusMapper;



    @Override
    public PageInfo selectAll(Integer sectionId, Integer stateId, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<ApparatusTableVo> apparatuses = apparatusMapper.selectAll(sectionId,stateId);
        PageInfo pi = new PageInfo<>(apparatuses);
        return pi;
    }



    @Override
    public List<Apparatus> selectApparatus() {

        return apparatusMapper.selectByExample(null);
    }

    @Override
    public boolean addApparatus(Apparatus apparatus) {
        return apparatusMapper.insertSelective(apparatus)>0?true:false;
    }

    @Override
    public int updateApparatus(Apparatus apparatus) {
        return apparatusMapper.updateByPrimaryKey(apparatus);
    }

}
